<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./css/bootstrap.css">
    <link rel="stylesheet" href="./css/font-awesome.css">
</head>
<body>
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-12">
                <h3>用户列表</h3>
    <a class="btn btn-success" href="./insert.html">插入用户数据 <i class="fa fa-plus-square fa-fw"></i></a>
              <table class="table table-bordered">
              <thead class="thead-dark">
                <tr>
                    <th>#</th>
                    <th>id</th>
                    <th>姓名</th>
                    <th>邮箱</th>
                    <th>电话号码</th>
                    <th>操作</th>
                </tr>
              </thead>
              <tbody>
<?php
  require_once "./conn.php";
  $result = mysqli_query($link,"select * from users");
  if(mysqli_num_rows($result)){
    $i=1;
    while($row=mysqli_fetch_array($result)){
?>   
        <tr>
            <th><?php echo $i; ?></th>
            <td><?php echo $row['id']; ?></td>
            <td><?php echo $row['name']; ?></td>
            <td><?php echo $row['email']; ?></td>
            <td><?php echo $row['mobile']; ?></td>
            <td>
                <a class="btn btn-success" href="./update.php?id=<?php echo $row['id']; ?>"><i class="fa fa-pencli">修改</i></a>
                <a class="btn btn-success" href=""><i class="fa fa-plus-square">删除</i></a>
            </td>
        </tr>
<?php
    $i++;
        }
    }else{
        echo "<tr><td colspan='6' class='text-center>无记录！ </td></tr>";
    }

?>
            </tbody>
            </table>
            </div>
        </div>
    </div>
</body>
</html>